<template>
    <input type="text" name="username" v-model="username">
    <br>
    <input type="password" name="password"  v-model="password">
    <input type="button" value="登录" @click="login">
</template>

<script setup>
import {ref,reactive} from 'vue'
import axios from "axios"
import router from '@/router'
import tmenu from '@/router/axios/tmenu'
import {useCounterStore} from "../stores/counter"


const store = useCounterStore()
const username = ref("")
const password = ref("")
const loginObj = reactive({
    username:username,
    password:password
})
const login =async()=>{ 
    let res = await store.login(loginObj)
        console.log(store.islogin );
        if(store.islogin){
            console.log(store.islogin);
          router.push("/main")
        }
}
</script> 